package person.learn.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.Repository;
import org.springframework.stereotype.Service;
import person.learn.entity.Goods;
import person.learn.repository.GoodsRepository;
import person.learn.service.GoodsService;
import person.learn.service.base.BaseService;

import java.util.List;
import java.util.Map;

/**
 * Created by barton on 16-1-29.
 */
@Service
public class GoodsServiceImpl extends BaseService<Goods> implements GoodsService {

    @Autowired
    private GoodsRepository goodsRepository;

    @Override
    public List<Goods> findAll() {
        return this.goodsRepository.findAll();
    }

    @Override
    public Goods save(Goods goods) {
        return goodsRepository.save(goods);
    }

    @Override
    public Page<Goods> findAllPage(Map<String, Object> searchParam, Pageable pageable) {
        return search(searchParam, pageable);
    }

    @Override
    public Goods findOne(Long id) {
        return this.goodsRepository.findOne(id);
    }

    @Override
    public GoodsRepository getRepository() {
        return this.goodsRepository;
    }
}
